import hashlib


def fileMd5(filePath):
    md5 = hashlib.md5()
    with open(filePath, mode="rb") as f:
        while True:
            data = f.read(1024)
            if not len(data):
                break
            md5.update(data)
    return md5.hexdigest()


if __name__ == '__main__':
    while True:
        filePath = input("请输入文件绝对路径:")
        try:
            print("MD5:%s"%fileMd5(filePath))
        except Exception as result:
            print(result)